using System.ComponentModel.DataAnnotations;

namespace KnowledgeQA.Models.Entities
{
    /// <summary>
    /// 文档块实体类（用于RAG检索）
    /// </summary>
    public class DocumentChunk : BaseEntity
    {
        /// <summary>
        /// 文档ID
        /// </summary>
        public int DocumentId { get; set; }

        /// <summary>
        /// 文档
        /// </summary>
        public virtual Document Document { get; set; } = null!;

        /// <summary>
        /// 块内容
        /// </summary>
        [Required]
        public string Content { get; set; } = string.Empty;

        /// <summary>
        /// 块序号
        /// </summary>
        public int ChunkIndex { get; set; }

        /// <summary>
        /// 块大小（字符数）
        /// </summary>
        public int ChunkSize { get; set; }

        /// <summary>
        /// 向量数据（JSON格式存储）
        /// </summary>
        public string? VectorData { get; set; }

        /// <summary>
        /// 向量ID（在向量数据库中的ID）
        /// </summary>
        [MaxLength(100)]
        public string? VectorId { get; set; }

        /// <summary>
        /// 元数据（JSON格式存储）
        /// </summary>
        [MaxLength(2000)]
        public string? Metadata { get; set; }

        /// <summary>
        /// 相关度评分
        /// </summary>
        public double? RelevanceScore { get; set; }

        /// <summary>
        /// 是否已向量化
        /// </summary>
        public bool IsVectorized { get; set; } = false;

        /// <summary>
        /// 处理状态
        /// </summary>
        [MaxLength(20)]
        public string Status { get; set; } = "Pending";
    }
} 